package cn.infomany;

import cn.infomany.constant.Resource;
import lombok.Data;

/**
 * 参数信息
 *
 * @author zjb
 */
@Data
public class Parameter {

    @com.beust.jcommander.Parameter(names = "-projectPath", description = "代码生成输出的位置")
    private String projectPath = System.getProperty("user.dir") + "/src/main/resources";

    @com.beust.jcommander.Parameter(names = "-author", description = "代码中${author}值")
    private String author;

    @com.beust.jcommander.Parameter(names = "-fileOverride", description = "文件存在是否覆盖")
    private boolean fileOverride = true;

    @com.beust.jcommander.Parameter(names = "-baseResultMap", description = "mapper.xml中是否开启resultMap")
    private boolean baseResultMap = true;

    @com.beust.jcommander.Parameter(names = "-open", description = "是否打开输出目录")
    private boolean open = false;


    /*  数据源配置   */
    @com.beust.jcommander.Parameter(names = "-url", description = "驱动连接的URL")
    private String url;

    @com.beust.jcommander.Parameter(names = "-driverName", description = "驱动名称")
    private String driverName;

    @com.beust.jcommander.Parameter(names = "-username", description = "数据库连接用户名")
    private String username;

    @com.beust.jcommander.Parameter(names = "-password", description = "数据库连接密码")
    private String password;


    /**
     * 包配置
     */
    @com.beust.jcommander.Parameter(names = "-parent", description = "父包名。如果为空，将下面子包名必须写全部， 否则就只需写子包名")
    private String parent;

    @com.beust.jcommander.Parameter(names = "-moduleName", description = "父包模块名")
    private String moduleName = Resource.STRING_EMPTY;

    /**
     * 模板配置
     */
    private String controller = Resource.TEMPLATE_CONTROLLER;
    private String service = Resource.TEMPLATE_SERVICE;
    private String serviceImpl = Resource.TEMPLATE_SERVICE_IMPL;
    private String mapper = Resource.TEMPLATE_MAPPER;
    private String entity = Resource.TEMPLATE_ENTITY_JAVA;
    private String xml = Resource.TEMPLATE_XML;
    private String dao = Resource.TEMPLATE_DAO;

    /**
     * 策略配置
     */
    @com.beust.jcommander.Parameter(names = "-entityLombokModel", description = "是否开启lombok")
    private boolean entityLombokModel = true;

    @com.beust.jcommander.Parameter(names = "-chainModel", description = "是否开启chainModel")
    private boolean chainModel = true;

    @com.beust.jcommander.Parameter(names = "-restControllerStyle", description = "是否使开启restControllerStyle模式")
    private boolean restControllerStyle = true;

    @com.beust.jcommander.Parameter(names = "-include", description = "需要逆向那些表")
    private String[] include;

    @com.beust.jcommander.Parameter(names = "-tablePrefix", description = "需要逆向表的前缀")
    private String[] tablePrefix;

    @com.beust.jcommander.Parameter(names = "-logicDeleteFieldName", description = "逻辑删除属性名称")
    private String logicDeleteFieldName = Resource.DELETED;

    @com.beust.jcommander.Parameter(names = "-versionFieldName", description = "乐观锁属性名称")
    private String versionFieldName = Resource.VERSION;

    @com.beust.jcommander.Parameter(names = {"-h", "--help"}, description = "显示帮助")
    private boolean help = false;
}
